/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.arhs.team1100.aerialassist.input;

import edu.arhs.team1100.aerialassist.handlers.TeamEventMatchHandler;
import edu.arhs.team1100.aerialassist.scouting.objects.Team;
import edu.arhs.team1100.aerialassist.scouting.objects.TeamEventMatch;
import java.text.DecimalFormat;
import java.util.List;

/**
 *
 * @author Eddie
 */
public class TeamDataViewer extends javax.swing.JFrame {

    boolean zoneChange;
    int zoneChangeNumber;
    boolean trussToss;
    int trussTossNumber;
    boolean trussCatch;
    int trussCatchNumber;
    boolean autoBallLow;
    int autoBallLowNumber;
    boolean autoBallHigh;
    int autoBallHighNumber;
    int ballsFromHP;
    double ballsFromHPAverage;
    int highGoalsScored;
    double highGoalAverage;
    int lowGoalsScored;
    double lowGoalAverage;
    int totalAssists;
    double averageAssists;
    int totalCycles;
    double averageCycles;
    int floorPickup;
    int defensive;
    String speedStability;
    String comments;
    /**
     * Creates new form TeamDataViewer
     */
    public TeamDataViewer(Team team) {
        initComponents();
        DecimalFormat df = new DecimalFormat("#");
        List<TeamEventMatch> matches = TeamEventMatchHandler.getMatchesFromTeam(team.getTeamNumber());

        for (int i = 0; i < matches.size(); i++) {
            if (matches.get(i).isZoneChange()) {
                zoneChangeBool.setText("Yes");
                zoneChangeNumber++;
            }
            if (matches.get(i).isAbleToTrussToss()) {
                trussTossBool.setText("Yes");
                trussTossNumber++;
            }
            if (matches.get(i).isAbleToTrussCatch()) {
                trussCatchBool.setText("Yes");
                trussCatchNumber++;
            }
            if (matches.get(i).getAutoBallGoal() == 1) {
                jLabel29.setText("Yes");
                autoBallLowNumber++;
            }
            if (matches.get(i).getAutoBallGoal() == 2) {
                jLabel30.setText("Yes");
                autoBallHighNumber++;
            }
            ballsFromHP += matches.get(i).getBallsCaughtFromHP();
            highGoalsScored += matches.get(i).getHighGoalsScored();
            lowGoalsScored += matches.get(i).getLowGoalsScored();
            
            totalAssists += matches.get(i).getAssists();
            totalCycles += matches.get(i).getCycles();
            
            floorPickup += matches.get(i).getFloorPickup();
            defensive += matches.get(i).getDefensive();
            
            speedStability += matches.get(i).getStability() + "\n";
            comments += matches.get(i).getComments() + "\n";
        }
        
        zoneChangeNumLabel1.setText("" + zoneChangeNumber);
        trussTossNumLabel1.setText("" + trussTossNumber);
        trussCatchNumLabel1.setText("" + trussCatchNumLabel1);
        
        jLabel31.setText("" + autoBallLowNumber);
        jLabel32.setText("" + autoBallHighNumber);
        
        jLabel6.setText("" + df.format(100* ballsFromHP/matches.size()) + "%");
        jLabel10.setText("" + df.format(100* lowGoalsScored/matches.size()) + "%");
        jLabel14.setText("" + df.format(100* highGoalsScored/matches.size()) + "%");
        
        jLabel20.setText("" + df.format(100* totalAssists/matches.size()) + "%");
        jLabel22.setText("" + df.format(100* totalCycles/matches.size()) + "%");
        
        jLabel24.setText("" + df.format(100* floorPickup/matches.size()) + "%");
        jLabel26.setText("" + df.format(100* defensive/matches.size()) + "%");
        
        jTextArea1.setText(speedStability);
        jTextArea2.setText(comments);
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel15 = new javax.swing.JLabel();
        zoneChangeLabel = new javax.swing.JLabel();
        zoneChangeBool = new javax.swing.JLabel();
        zoneChangeNumberLabel = new javax.swing.JLabel();
        zoneChangeNumLabel1 = new javax.swing.JLabel();
        trussTossLabel = new javax.swing.JLabel();
        trussTossBool = new javax.swing.JLabel();
        trussTossNumberLabel = new javax.swing.JLabel();
        trussTossNumLabel1 = new javax.swing.JLabel();
        trussCatchLabel = new javax.swing.JLabel();
        trussCatchBool = new javax.swing.JLabel();
        trussCatchNumberLabel = new javax.swing.JLabel();
        trussCatchNumLabel1 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        trussCatchNumberLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        trussCatchNumberLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel28 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel15.setText("Total Assists:");

        zoneChangeLabel.setText("Zone Change: ");

        zoneChangeBool.setText("No");

        zoneChangeNumberLabel.setText("Number of Games:");

        zoneChangeNumLabel1.setText("0");

        trussTossLabel.setText("Truss Toss:");

        trussTossBool.setText("No");

        trussTossNumberLabel.setText("Number of Games:");

        trussTossNumLabel1.setText("0");

        trussCatchLabel.setText("Truss Catch:");

        trussCatchBool.setText("No");

        trussCatchNumberLabel.setText("Number of Games:");

        trussCatchNumLabel1.setText("0");

        jLabel1.setText("Auto Ball Low:");

        trussCatchNumberLabel1.setText("Number of Games:");

        jLabel2.setText("Auto Ball High:");

        trussCatchNumberLabel2.setText("Number of Games:");

        jLabel3.setText("Balls From HP:");

        jLabel4.setText("0");

        jLabel5.setText("Overall Average:");

        jLabel6.setText("0");

        jLabel7.setText("Low Goals Scored:");

        jLabel8.setText("0");

        jLabel9.setText("Overall Average:");

        jLabel10.setText("0");

        jLabel11.setText("High Goals Scored:");

        jLabel12.setText("0");

        jLabel13.setText("Overall Average:");

        jLabel14.setText("0");

        jLabel16.setText("Average Assists:");

        jLabel17.setText("Total Scoring Cycles:");

        jLabel18.setText("Average Cycles:");

        jLabel19.setText("0");

        jLabel20.setText("0");

        jLabel21.setText("0");

        jLabel22.setText("0");

        jLabel23.setText("Average Floor Pickup:");

        jLabel24.setText("0");

        jLabel25.setText("Average Defensive: ");

        jLabel26.setText("0");

        jLabel27.setText("Speed / Stability");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jTextArea1.setWrapStyleWord(true);
        jScrollPane1.setViewportView(jTextArea1);

        jLabel28.setText("Comments");

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jTextArea2.setWrapStyleWord(true);
        jScrollPane2.setViewportView(jTextArea2);

        jLabel29.setText("No");

        jLabel30.setText("No");

        jLabel31.setText("0");

        jLabel32.setText("0");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel26))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(zoneChangeLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(zoneChangeBool))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(trussTossLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(trussTossBool))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(trussCatchLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(trussCatchBool))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel29))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel30))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel4))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel8))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel12))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel19))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel17)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel21))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel23)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel24))
                            .addComponent(jLabel27)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(54, 54, 54)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel28)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel18)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel22))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel16)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel20))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel14))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel9)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel10))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel6))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(trussCatchNumberLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel32))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(trussCatchNumberLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel31))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(trussCatchNumberLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(trussCatchNumLabel1))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(zoneChangeNumberLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(zoneChangeNumLabel1))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(trussTossNumberLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(trussTossNumLabel1))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(zoneChangeLabel)
                    .addComponent(zoneChangeBool)
                    .addComponent(zoneChangeNumberLabel)
                    .addComponent(zoneChangeNumLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(trussTossLabel)
                    .addComponent(trussTossBool)
                    .addComponent(trussTossNumberLabel)
                    .addComponent(trussTossNumLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(trussCatchLabel)
                    .addComponent(trussCatchBool)
                    .addComponent(trussCatchNumberLabel)
                    .addComponent(trussCatchNumLabel1))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(trussCatchNumberLabel1)
                    .addComponent(jLabel29)
                    .addComponent(jLabel31))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(trussCatchNumberLabel2)
                    .addComponent(jLabel30)
                    .addComponent(jLabel32))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16)
                    .addComponent(jLabel19)
                    .addComponent(jLabel20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jLabel18)
                    .addComponent(jLabel21)
                    .addComponent(jLabel22))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(jLabel24))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(jLabel26))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(jLabel28))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                    .addComponent(jScrollPane1))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JLabel trussCatchBool;
    private javax.swing.JLabel trussCatchLabel;
    private javax.swing.JLabel trussCatchNumLabel1;
    private javax.swing.JLabel trussCatchNumberLabel;
    private javax.swing.JLabel trussCatchNumberLabel1;
    private javax.swing.JLabel trussCatchNumberLabel2;
    private javax.swing.JLabel trussTossBool;
    private javax.swing.JLabel trussTossLabel;
    private javax.swing.JLabel trussTossNumLabel1;
    private javax.swing.JLabel trussTossNumberLabel;
    private javax.swing.JLabel zoneChangeBool;
    private javax.swing.JLabel zoneChangeLabel;
    private javax.swing.JLabel zoneChangeNumLabel1;
    private javax.swing.JLabel zoneChangeNumberLabel;
    // End of variables declaration//GEN-END:variables
}
